package cn.bluethink.eguan.statistics.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.github.pagehelper.Page;

import cn.bluethink.eguan.statistics.entity.EgTargetEntity;
import tk.mybatis.mapper.common.Mapper;

public interface EgTargetMapper extends Mapper<EgTargetEntity> {

	public Page<EgTargetEntity> tracktarget(@Param("fid") Long fid, @Param("egid") Long egid, @Param("timing") Integer timing,  @Param("btime") String btime, @Param("etime") String etime) throws Exception;
	
	/**
	 *  查询驿馆中所有已完成的验收项
	 * @param btime
	 * @param etime
	 * @param egid
	 * @param fid
	 * @param timing
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> completekrs(@Param("btime")String btime, @Param("etime")String etime, @Param("egid") Long egid, @Param("fid") Long fid, @Param("timing") Integer timing)throws Exception;
	
	/**
	 *  查询驿馆中所有验收项
	 * @param btime
	 * @param etime
	 * @param egid
	 * @param fid
	 * @param timing
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> krcount(@Param("btime")String btime, @Param("etime")String etime, @Param("egid") Long egid,@Param("fid") Long fid, @Param("timing") Integer timing)throws Exception;

	/**
	 *  根据任务目标id查询任务前置任务目标id
	 * @param tid
	 * @return
	 * @throws Exception
	 */
	public List<Long> relatetargetsByTid(@Param("tid")Long tid)throws Exception;

	/**
	 * 根据驿馆Id查询该驿馆中未关联前置目标的所有目标
	 * @param egid
	 * @return
	 * @throws Exception
	 */
	public List<Long> unrelatedIds(@Param("fid") Long fid, @Param("egid") Long egid,  @Param("btime") String btime, @Param("etime") String etime) throws Exception;
	
	/**
	 * 根据驿馆Id查询该驿馆中所有的前置目标pre_target
	 * @param egid
	 * @return
	 * @throws Exception
	 */
	public List<Long> pretargets(@Param("fid") Long fid, @Param("egid") Long egid,  @Param("btime") String btime, @Param("etime") String etime) throws Exception;
	
	/**
	 * 根据驿馆Id查询该驿馆中目标Id及其关联的目标Id
	 * @param egid
	 * @return
	 * @throws Exception
	 */
	public List<EgTargetEntity> relatedtargets(@Param("fid") Long fid, @Param("egid") Long egid,  @Param("btime") String btime, @Param("etime") String etime) throws Exception;
 
  }
